#ifndef __64BIT_KERNEL_IDT_H__
#define __64BIT_KERNEL_IDT_H__
#include "types.h"

typedef struct _idtr_data_t
{
    u16 limit;
    int64 base;
} __attribute__((packed)) idtr_data_t;

typedef struct _idt_item_t
{
    short offset0;
    short selector;
    char ist;
    char type: 4; // 任务门/中断门/陷阱门
    char segment: 1; // segment = 0 表示系统段
    char dpl : 2; // 使用最低权限
    char present: 1; // 是否有效
    short offset1;
    int offset2;
    int reserved;
} __attribute__((packed)) idt_item_t;

void install_idt_item(int index, int64 handler, short selector, char ist, char dpl);
void idt_init();
void send_eoi(int idt_index);
#endif